<!--
 * @Author: Leo.wang wanglizhigs@163.com
 * @Date: 2023-12-06 13:35:52
 * @LastEditors: Leo.wang wanglizhigs@163.com
 * @LastEditTime: 2024-01-29 23:47:24
 * @FilePath: /tuberculosis_screening_app/src/components/common/card.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <div class="card" :style="{ backgroundColor: `${color}20`, color }">
    <div class="card-header" v-if="title" :style="{ backgroundColor: color }">{{ title }} <small>{{unit}}</small></div>
    <div class="card-body">
      <slot></slot>
    </div>
    <!-- <div class="card-footer">footer</div> -->
  </div>
</template>

<script lang="ts">
import { defineComponent } from 'vue';

export default defineComponent({
  name: 'Card',
  props: {
    title: {
      type: String,
      default: '',
    },
    color: String,
    unit: String,
  },
});
</script>

<style lang="scss" scoped>
@import '@/styles/variables.scss';
.card {
  background: $white-color;
  border-radius: $radius;

  .card-header {
    // background: linear-gradient(to right, #f79a7c, rgba(#ffffff, 0));
    color: #ffffff;
    font-weight: bold;
    font-size: map-get($font-sizes, md);
    border-top-left-radius: $radius;
    border-top-right-radius: $radius;
    padding: map-get($spaces, sm);
  }
  .card-body {
  }
  .card-footer {
    border-bottom-left-radius: $radius;
    border-bottom-right-radius: $radius;
  }
}
</style>

